import { dictionary_all } from '@/api/system.js';
import Menu from '@/utils/menu';
const state = {
  dictionary_all: {}
};
const mutations = {
  SET_DICTIONARY: (state, data) => {
    state.dictionary_all = data;
  }
};

const actions = {
  async getDictionaryAll({ commit }) {
    const res = await dictionary_all();
    const dics = res.data;
    const obj = Menu.dicFilter(dics);
    obj.question_types.map(i => {
      i.value = Number(i.value);
    });
    obj.exam_types.map(i => {
      i.value = Number(i.value);
    });
    commit('SET_DICTIONARY', obj);
  }
};
export default {
  namespaced: true,
  state,
  actions,
  mutations
};
